package com.twu.biblioteca;

import java.util.Iterator;
import java.util.List;

public class Library implements Iterable<LibraryBook>{
    private List<LibraryBook> bookList;

    public Library(List<LibraryBook> bookList) {
        this.bookList = bookList;
    }

    @Override
    public Iterator<LibraryBook> iterator() {
        return bookList.listIterator();
    }

    public LibraryBook findBook(String title) {
        for (LibraryBook libraryBook : bookList) {
            if(libraryBook.toString().equals(title))
                return libraryBook;
        }
        return null;
    }
}
